using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._RelationshipClasses
{
    /// <summary>
    /// <para>Table To Relationship Class</para>
    /// <para>Creates an attributed relationship class from the origin, destination, and relationship tables.</para>
    /// <para>从源、目标和关系表创建属性化关系类。</para>
    /// </summary>    
    [DisplayName("Table To Relationship Class")]
    public class TableToRelationshipClass : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public TableToRelationshipClass()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_origin_table">
        /// <para>Origin Table</para>
        /// <para>The table or feature class that will be associated to the destination table.</para>
        /// <para>将关联到目标表的表或要素类。</para>
        /// </param>
        /// <param name="_destination_table">
        /// <para>Destination Table</para>
        /// <para>The table or feature class that will be associated to the origin table.</para>
        /// <para>将关联到源表的表或要素类。</para>
        /// </param>
        /// <param name="_out_relationship_class">
        /// <para>Output Relationship Class</para>
        /// <para>The relationship class that will be created.</para>
        /// <para>将创建的关系类。</para>
        /// </param>
        /// <param name="_relationship_type">
        /// <para>Relationship Type</para>
        /// <para><xdoc>
        ///   <para>The type of association to create between the origin and destination tables.</para>
        ///   <bulletList>
        ///     <bullet_item>Simple—An association where each object is independent of each other (a parent-to-parent relationship). This is the default.</bullet_item><para/>
        ///     <bullet_item>Composite—An association where the lifetime of one object controls the lifetime of its related object (a parent-child relationship).</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要在源表和目标表之间创建的关联类型。</para>
        ///   <bulletList>
        ///     <bullet_item>简单 - 每个对象彼此独立的关联（父对象到父对象关系）。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>复合 - 一个对象的生存期控制其相关对象的生存期（父子关系）的关联。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        /// <param name="_forward_label">
        /// <para>Forward Path Label</para>
        /// <para>A label describing the relationship as it is traversed from the origin table/feature class to the destination table/feature class.</para>
        /// <para>描述从源表/要素类遍历到目标表/要素类时关系的标注。</para>
        /// </param>
        /// <param name="_backward_label">
        /// <para>Backward Path Label</para>
        /// <para>A label describing the relationship as it is traversed from the destination table/feature class to the origin table/feature class.</para>
        /// <para>描述从目标表/要素类遍历到源表/要素类的关系的标注。</para>
        /// </param>
        /// <param name="_message_direction">
        /// <para>Message Direction</para>
        /// <para><xdoc>
        ///   <para>The direction messages will be propagated between the objects in the relationship. For example, in a relationship between poles and transformers, when the pole is deleted, it sends a message to its related transformer objects informing them it was deleted.</para>
        ///   <bulletList>
        ///     <bullet_item>None (no messages propagated)—No messages propagated. This is the default.</bullet_item><para/>
        ///     <bullet_item>Forward (origin to destination)—Messages propagated from the origin to the destination.</bullet_item><para/>
        ///     <bullet_item>Backward (destination to origin)—Messages propagated from the destination to the origin.</bullet_item><para/>
        ///     <bullet_item>Both directions—Messages propagated from the origin to the destination and from the destination to the origin.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>方向消息将在关系中的对象之间传播。例如，在电线杆和变压器之间的关系中，当电线杆被删除时，它会向其相关的变压器对象发送一条消息，通知它们已被删除。</para>
        ///   <bulletList>
        ///     <bullet_item>无（无消息传播）- 无消息传播。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>转发（源到目标）- 从源传播到目标的消息。</bullet_item><para/>
        ///     <bullet_item>向后（目标到源）- 从目标传播到源的消息。</bullet_item><para/>
        ///     <bullet_item>双向 - 从源传播到目标以及从目标传播到源的消息。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        /// <param name="_cardinality">
        /// <para>Cardinality</para>
        /// <para><xdoc>
        ///   <para>The cardinality of the relationship between the origin and destination.</para>
        ///   <bulletList>
        ///     <bullet_item>One to one (1:1)—Each object of the origin table/feature class can be related to zero or one object of the destination table/feature class. This is the default.</bullet_item><para/>
        ///     <bullet_item>One to many (1:M)—Each object of the origin table/feature class can be related to multiple objects in the destination table/feature class.</bullet_item><para/>
        ///     <bullet_item>Many to many (M:N)—Multiple objects of the origin table/feature class can be related to multiple objects in the destination table/feature class.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>起点和终点之间关系的基数。</para>
        ///   <bulletList>
        ///     <bullet_item>一对一 （1：1） - 源表/要素类的每个对象可以与目标表/要素类的零个对象或一个对象相关。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>一对多 （1：M） - 源表/要素类的每个对象都可以与目标表/要素类中的多个对象相关联。</bullet_item><para/>
        ///     <bullet_item>多对多 （M：N） - 源表/要素类的多个对象可以与目标表/要素类中的多个对象相关联。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        /// <param name="_relationship_table">
        /// <para>Relationship Table</para>
        /// <para>The table containing attributes that will be added to the relationship class.</para>
        /// <para>包含将添加到关系类的属性的表。</para>
        /// </param>
        /// <param name="_attribute_fields">
        /// <para>Attribute Fields</para>
        /// <para><xdoc>
        ///   <para>The fields containing attribute values that will be added to the relationship class.</para>
        ///   <para>The Add Field button, which is used only in ModelBuilder, allows you to add expected field(s) so you can complete the dialog and continue to build your model.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含将添加到关系类的属性值的字段。</para>
        ///   <para>添加字段按钮仅在模型构建器中使用，可用于添加预期字段，以便完成对话框并继续构建模型。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_origin_primary_key">
        /// <para>Origin Primary Key</para>
        /// <para>The field in the origin table that will be used to create the relationship. Generally, this is the object identifier field.</para>
        /// <para>源表中将用于创建关系的字段。通常，这是对象标识符字段。</para>
        /// </param>
        /// <param name="_origin_foreign_key">
        /// <para>Origin Foreign Key</para>
        /// <para>The name of the Foreign Key field in the relationship table that refers to the Primary Key field in the origin table/feature class.</para>
        /// <para>关系表中引用源表/要素类中的主键字段的名称。</para>
        /// </param>
        /// <param name="_destination_primary_key">
        /// <para>Destination Primary Key</para>
        /// <para>The field in the destination table that will be used to create the relationship. Generally, this is the object identifier field.</para>
        /// <para>目标表中将用于创建关系的字段。通常，这是对象标识符字段。</para>
        /// </param>
        /// <param name="_destination_foreign_key">
        /// <para>Destination Foreign Key</para>
        /// <para>The field in the relationship table that refers to the Primary Key field in the destination table.</para>
        /// <para>关系表中引用目标表中主键字段的字段。</para>
        /// </param>
        public TableToRelationshipClass(object _origin_table, object _destination_table, object _out_relationship_class, _relationship_type_value _relationship_type, object _forward_label, object _backward_label, _message_direction_value _message_direction, _cardinality_value _cardinality, object _relationship_table, List<object> _attribute_fields, object _origin_primary_key, object _origin_foreign_key, object _destination_primary_key, object _destination_foreign_key)
        {
            this._origin_table = _origin_table;
            this._destination_table = _destination_table;
            this._out_relationship_class = _out_relationship_class;
            this._relationship_type = _relationship_type;
            this._forward_label = _forward_label;
            this._backward_label = _backward_label;
            this._message_direction = _message_direction;
            this._cardinality = _cardinality;
            this._relationship_table = _relationship_table;
            this._attribute_fields = _attribute_fields;
            this._origin_primary_key = _origin_primary_key;
            this._origin_foreign_key = _origin_foreign_key;
            this._destination_primary_key = _destination_primary_key;
            this._destination_foreign_key = _destination_foreign_key;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Table To Relationship Class";

        public override string CallName => "management.TableToRelationshipClass";

        public override List<string> AcceptEnvironments => ["autoCommit", "workspace"];

        public override object[] ParameterInfo => [_origin_table, _destination_table, _out_relationship_class, _relationship_type.GetGPValue(), _forward_label, _backward_label, _message_direction.GetGPValue(), _cardinality.GetGPValue(), _relationship_table, _attribute_fields, _origin_primary_key, _origin_foreign_key, _destination_primary_key, _destination_foreign_key];

        /// <summary>
        /// <para>Origin Table</para>
        /// <para>The table or feature class that will be associated to the destination table.</para>
        /// <para>将关联到目标表的表或要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Origin Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _origin_table { get; set; }


        /// <summary>
        /// <para>Destination Table</para>
        /// <para>The table or feature class that will be associated to the origin table.</para>
        /// <para>将关联到源表的表或要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Destination Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _destination_table { get; set; }


        /// <summary>
        /// <para>Output Relationship Class</para>
        /// <para>The relationship class that will be created.</para>
        /// <para>将创建的关系类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Relationship Class")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_relationship_class { get; set; }


        /// <summary>
        /// <para>Relationship Type</para>
        /// <para><xdoc>
        ///   <para>The type of association to create between the origin and destination tables.</para>
        ///   <bulletList>
        ///     <bullet_item>Simple—An association where each object is independent of each other (a parent-to-parent relationship). This is the default.</bullet_item><para/>
        ///     <bullet_item>Composite—An association where the lifetime of one object controls the lifetime of its related object (a parent-child relationship).</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要在源表和目标表之间创建的关联类型。</para>
        ///   <bulletList>
        ///     <bullet_item>简单 - 每个对象彼此独立的关联（父对象到父对象关系）。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>复合 - 一个对象的生存期控制其相关对象的生存期（父子关系）的关联。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Relationship Type")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _relationship_type_value _relationship_type { get; set; }

        public enum _relationship_type_value
        {
            /// <summary>
            /// <para>Simple</para>
            /// <para>Simple—An association where each object is independent of each other (a parent-to-parent relationship). This is the default.</para>
            /// <para>简单 - 每个对象彼此独立的关联（父对象到父对象关系）。这是默认设置。</para>
            /// </summary>
            [Description("Simple")]
            [GPEnumValue("SIMPLE")]
            _SIMPLE,

            /// <summary>
            /// <para>Composite</para>
            /// <para>Composite—An association where the lifetime of one object controls the lifetime of its related object (a parent-child relationship).</para>
            /// <para>复合 - 一个对象的生存期控制其相关对象的生存期（父子关系）的关联。</para>
            /// </summary>
            [Description("Composite")]
            [GPEnumValue("COMPOSITE")]
            _COMPOSITE,

        }

        /// <summary>
        /// <para>Forward Path Label</para>
        /// <para>A label describing the relationship as it is traversed from the origin table/feature class to the destination table/feature class.</para>
        /// <para>描述从源表/要素类遍历到目标表/要素类时关系的标注。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Forward Path Label")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _forward_label { get; set; }


        /// <summary>
        /// <para>Backward Path Label</para>
        /// <para>A label describing the relationship as it is traversed from the destination table/feature class to the origin table/feature class.</para>
        /// <para>描述从目标表/要素类遍历到源表/要素类的关系的标注。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Backward Path Label")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _backward_label { get; set; }


        /// <summary>
        /// <para>Message Direction</para>
        /// <para><xdoc>
        ///   <para>The direction messages will be propagated between the objects in the relationship. For example, in a relationship between poles and transformers, when the pole is deleted, it sends a message to its related transformer objects informing them it was deleted.</para>
        ///   <bulletList>
        ///     <bullet_item>None (no messages propagated)—No messages propagated. This is the default.</bullet_item><para/>
        ///     <bullet_item>Forward (origin to destination)—Messages propagated from the origin to the destination.</bullet_item><para/>
        ///     <bullet_item>Backward (destination to origin)—Messages propagated from the destination to the origin.</bullet_item><para/>
        ///     <bullet_item>Both directions—Messages propagated from the origin to the destination and from the destination to the origin.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>方向消息将在关系中的对象之间传播。例如，在电线杆和变压器之间的关系中，当电线杆被删除时，它会向其相关的变压器对象发送一条消息，通知它们已被删除。</para>
        ///   <bulletList>
        ///     <bullet_item>无（无消息传播）- 无消息传播。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>转发（源到目标）- 从源传播到目标的消息。</bullet_item><para/>
        ///     <bullet_item>向后（目标到源）- 从目标传播到源的消息。</bullet_item><para/>
        ///     <bullet_item>双向 - 从源传播到目标以及从目标传播到源的消息。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Message Direction")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _message_direction_value _message_direction { get; set; }

        public enum _message_direction_value
        {
            /// <summary>
            /// <para>Forward (origin to destination)</para>
            /// <para>Forward (origin to destination)—Messages propagated from the origin to the destination.</para>
            /// <para>转发（源到目标）- 从源传播到目标的消息。</para>
            /// </summary>
            [Description("Forward (origin to destination)")]
            [GPEnumValue("FORWARD")]
            _FORWARD,

            /// <summary>
            /// <para>Backward (destination to origin)</para>
            /// <para>Backward (destination to origin)—Messages propagated from the destination to the origin.</para>
            /// <para>向后（目标到源）- 从目标传播到源的消息。</para>
            /// </summary>
            [Description("Backward (destination to origin)")]
            [GPEnumValue("BACKWARD")]
            _BACKWARD,

            /// <summary>
            /// <para>Both directions</para>
            /// <para>Both directions—Messages propagated from the origin to the destination and from the destination to the origin.</para>
            /// <para>双向 - 从源传播到目标以及从目标传播到源的消息。</para>
            /// </summary>
            [Description("Both directions")]
            [GPEnumValue("BOTH")]
            _BOTH,

            /// <summary>
            /// <para>None (no messages propagated)</para>
            /// <para>None (no messages propagated)—No messages propagated. This is the default.</para>
            /// <para>无（无消息传播）- 无消息传播。这是默认设置。</para>
            /// </summary>
            [Description("None (no messages propagated)")]
            [GPEnumValue("NONE")]
            _NONE,

        }

        /// <summary>
        /// <para>Cardinality</para>
        /// <para><xdoc>
        ///   <para>The cardinality of the relationship between the origin and destination.</para>
        ///   <bulletList>
        ///     <bullet_item>One to one (1:1)—Each object of the origin table/feature class can be related to zero or one object of the destination table/feature class. This is the default.</bullet_item><para/>
        ///     <bullet_item>One to many (1:M)—Each object of the origin table/feature class can be related to multiple objects in the destination table/feature class.</bullet_item><para/>
        ///     <bullet_item>Many to many (M:N)—Multiple objects of the origin table/feature class can be related to multiple objects in the destination table/feature class.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>起点和终点之间关系的基数。</para>
        ///   <bulletList>
        ///     <bullet_item>一对一 （1：1） - 源表/要素类的每个对象可以与目标表/要素类的零个对象或一个对象相关。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>一对多 （1：M） - 源表/要素类的每个对象都可以与目标表/要素类中的多个对象相关联。</bullet_item><para/>
        ///     <bullet_item>多对多 （M：N） - 源表/要素类的多个对象可以与目标表/要素类中的多个对象相关联。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Cardinality")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _cardinality_value _cardinality { get; set; }

        public enum _cardinality_value
        {
            /// <summary>
            /// <para>One to one (1:1)</para>
            /// <para>One to one (1:1)—Each object of the origin table/feature class can be related to zero or one object of the destination table/feature class. This is the default.</para>
            /// <para>一对一 （1：1） - 源表/要素类的每个对象可以与目标表/要素类的零个对象或一个对象相关。这是默认设置。</para>
            /// </summary>
            [Description("One to one (1:1)")]
            [GPEnumValue("ONE_TO_ONE")]
            _ONE_TO_ONE,

            /// <summary>
            /// <para>One to many (1:M)</para>
            /// <para>One to many (1:M)—Each object of the origin table/feature class can be related to multiple objects in the destination table/feature class.</para>
            /// <para>一对多 （1：M） - 源表/要素类的每个对象都可以与目标表/要素类中的多个对象相关联。</para>
            /// </summary>
            [Description("One to many (1:M)")]
            [GPEnumValue("ONE_TO_MANY")]
            _ONE_TO_MANY,

            /// <summary>
            /// <para>Many to many (M:N)</para>
            /// <para>Many to many (M:N)—Multiple objects of the origin table/feature class can be related to multiple objects in the destination table/feature class.</para>
            /// <para>多对多 （M：N） - 源表/要素类的多个对象可以与目标表/要素类中的多个对象相关联。</para>
            /// </summary>
            [Description("Many to many (M:N)")]
            [GPEnumValue("MANY_TO_MANY")]
            _MANY_TO_MANY,

        }

        /// <summary>
        /// <para>Relationship Table</para>
        /// <para>The table containing attributes that will be added to the relationship class.</para>
        /// <para>包含将添加到关系类的属性的表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Relationship Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _relationship_table { get; set; }


        /// <summary>
        /// <para>Attribute Fields</para>
        /// <para><xdoc>
        ///   <para>The fields containing attribute values that will be added to the relationship class.</para>
        ///   <para>The Add Field button, which is used only in ModelBuilder, allows you to add expected field(s) so you can complete the dialog and continue to build your model.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含将添加到关系类的属性值的字段。</para>
        ///   <para>添加字段按钮仅在模型构建器中使用，可用于添加预期字段，以便完成对话框并继续构建模型。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Attribute Fields")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _attribute_fields { get; set; }


        /// <summary>
        /// <para>Origin Primary Key</para>
        /// <para>The field in the origin table that will be used to create the relationship. Generally, this is the object identifier field.</para>
        /// <para>源表中将用于创建关系的字段。通常，这是对象标识符字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Origin Primary Key")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _origin_primary_key { get; set; }


        /// <summary>
        /// <para>Origin Foreign Key</para>
        /// <para>The name of the Foreign Key field in the relationship table that refers to the Primary Key field in the origin table/feature class.</para>
        /// <para>关系表中引用源表/要素类中的主键字段的名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Origin Foreign Key")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _origin_foreign_key { get; set; }


        /// <summary>
        /// <para>Destination Primary Key</para>
        /// <para>The field in the destination table that will be used to create the relationship. Generally, this is the object identifier field.</para>
        /// <para>目标表中将用于创建关系的字段。通常，这是对象标识符字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Destination Primary Key")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _destination_primary_key { get; set; }


        /// <summary>
        /// <para>Destination Foreign Key</para>
        /// <para>The field in the relationship table that refers to the Primary Key field in the destination table.</para>
        /// <para>关系表中引用目标表中主键字段的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Destination Foreign Key")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _destination_foreign_key { get; set; }


        public TableToRelationshipClass SetEnv(int? autoCommit = null, object workspace = null)
        {
            base.SetEnv(autoCommit: autoCommit, workspace: workspace);
            return this;
        }

    }

}